Skip to content

Conversation

@tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #35302

Problem Summary:

'like' expression does not consider NO_BACKSLASH_ESCAPES sql_mode.
Its behavior differs from MySQL, so that's is a bug.

What changed and how does it work?

Fix this buggy behaviour maybe risky because we break the compatibility with old tidb version.
So after discussing with PM, a new system variable is introduced: @@tidb_enable_no_backslash_escapes_in_like

When a cluster is upgrade from old cluster, @@tidb_enable_no_backslash_escapes_in_like will be 'off', so it keep the old behavior.
For new bootstraped cluster, the value @@tidb_enable_no_backslash_escapes_in_like is 'on', and the bug are fixed on newer tidb.

If an user want the new behavior when the upgrade from an old tidb cluster, they have to manually operate:

set @@global.tidb_enable_no_backslash_escapes_in_like = 'on';

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Check the value of @@tidb_enable_no_backslash_escapes_in_like for new bootstraped cluster and old upgraded cluster.

  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix bug that 'like' expression does not comply with NO_BACKSLASH_ESCAPES sql_mode. After this fix, the behavior between MySQL and TiDB is the same.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/planner SIG: Planner labels Feb 2, 2026
@tiprow
Copy link

tiprow bot commented Feb 2, 2026

Hi @tiancaiamao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 2, 2026
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 97.86096% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.7699%. Comparing base (6ff1adf) to head (507b2b4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #65973        +/-   ##
================================================
+ Coverage   77.7600%   78.7699%   +1.0098%     
================================================
  Files          2001       1940        -61     
  Lines        546165     533827     -12338     
================================================
- Hits         424698     420495      -4203     
+ Misses       119805     112332      -7473     
+ Partials       1662       1000       -662     
Flag Coverage Δ
integration 44.8701% <95.5414%> (-3.3165%) ⬇️
unit 76.6987% <96.7914%> (+0.3147%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 65.5587% <ø> (+4.5870%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 2, 2026
@tiancaiamao tiancaiamao changed the title *: fix bug of 'like' expression with NO_BACKSLASH_ESCAPES sql_mode *: fix bug of 'like' expression with NO_BACKSLASH_ESCAPES sql_mode | tidb-test=pr/2678 Feb 2, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign benmeadowcroft, bornchanger, time-and-fate for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tiancaiamao
Copy link
Contributor Author

/test unit-test

@tiprow
Copy link

tiprow bot commented Feb 2, 2026

@tiancaiamao: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@tiancaiamao
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Feb 2, 2026

@tiancaiamao: PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql_mode NO_BACKSLASH_ESCAPES not in effect

1 participant